package com.yonyou.pmclouds.visitcard.rmiimpl;

import com.alibaba.dubbo.config.annotation.Service;
import com.yonyou.pmclouds.ApplicationConsts;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.picture.rmiitf.PictureRemoteService;
import com.yonyou.pmclouds.visitcard.entity.VisitCardVO;
import com.yonyou.pmclouds.visitcard.mapper.VisitCardMapper;
import com.yonyou.pmclouds.visitcard.rmiitf.VisitCardQuery;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

@Service(version = ApplicationConsts.APPLICATION_VERSION, interfaceClass = VisitCardQuery.class)
public class VisitCardQueryImpl implements VisitCardQuery {

    @Autowired
    private VisitCardMapper visitCardMapper;

    @Autowired
    private PictureRemoteService pictureRemoteService;

    @Override
    public VisitCardVO queryById(String id) throws BusinessException {
        VisitCardVO visitCardVO = visitCardMapper.getById(id);
        // 照片
        String[] picsArray = pictureRemoteService.queryPicNamesByPkEntity(visitCardVO.getPkVisitcard());
        visitCardVO.setPictures(picsArray);
        return visitCardVO;
    }
}
